package com.bocommlife.mi

/**
 * @author ${user.name}
 */
object App {

  def foo(x: Array[String]) = x.foldRight("")(
    (a, b) => a + "." + b)

  def main(args: Array[String]) {
    println("Hello World!")
    println("concat arguments = " + foo(args))
//    val a = List(1, 2, 3).foldLeft(0)((sum, i) => sum * i)
//
//    println(a)
    
//  var a:Map[String,Int]=Map("k1"->1,"k2"->2)//初始化构造函数
    var a = List(1,2,3)
    var b = Map("k1"->1, 3->2)
    
    println(b)
    b.foreach{case (e,i) => println(e,i)}
    b.foreach{f=>println(f)}
    
    a.foreach{case 1 => println("1") case _ => println("aaa...")}
//    helloWhat("jimmy")
    greetingWhat(helloWhat, "jimmy")
    
    val s = getTuple("s")
    println(s)
    
    for (e <- (1 to 6)){
      println(e)
    }
  }
  
  def helloWhat(what: String) = {print("hello " + what)}

  def getTuple(x: String) = { "ABC" }
  def greetingWhat(what: String => Unit, name: String) = {println("greeting2 ");what(name)}
}
